<?php
/**
 * @version SVN: $Id: builder.php 469 2011-07-29 19:03:30Z elkuku $
 * @package    Cyclemodules
 * @subpackage Base
 * @author     Miguel Puig {@link freebandtech.com}
 * @author     Created on 17-Feb-2012
 * @license    GNU/GPL
 */

//-- No direct access
defined('_JEXEC') || die('=;)');

/**
 * Helper class for Cyclemodules.
 */
class ModCyclemodulesHelper
{
    /**
     * Returns a list of random users.
     *
     * @param integer $userCount How many users to display
     *
     * @return array
     */
     
     function loadModules($position,$moduleclass,$moduleid,$shuffle,$rendertype){

     $document   = &JFactory::getDocument();
     $renderer   = $document->loadRenderer('module');
     $modules = &JModuleHelper::getModules($position);
     $options = array('style'=>$rendertype);
	
	 if($shuffle==1)
		 shuffle($modules);
	
	
		$render = '<div id="cyclemodules_cont'.$moduleid.'" class="container_cyclemodules'.$moduleclass.'">';
		foreach( $modules As $mod ){
			$render .= '<div id="module'.$moduleid.'">';
    			$render .= $renderer->render($mod, $options);
    		$render .= '</div>';
    	}
	$render .= '</div>';
	
	echo $render;
    
}
     
}//class
